import { Module } from '@nestjs/common';
import { PageService } from './page.service';
import { PageController } from './page.controller';
import { PageConfigService } from './page-config/page-config.service';
import { Page } from './entities/page.entity';
import { PageConfig } from './page-config/entities/page-config.entity';
@Module({
  controllers: [PageController],
  providers: [
    PageService,
    PageConfigService,
    {
      provide: 'PAGE_REPOSITORY',
      useFactory: async (AppDataSource) => {
        return AppDataSource.getRepository(Page);
      },
      inject: ['MONGODB_DATA_SOURCE'],
    },
    {
      provide: 'PAGE_CONFIG_REPOSITORY',
      useFactory: async (AppDataSource) => {
        return AppDataSource.getRepository(PageConfig);
      },
      inject: ['MONGODB_DATA_SOURCE'],
    },
  ],
  exports: ['PAGE_REPOSITORY', 'PAGE_CONFIG_REPOSITORY'],
})
export class PageModule {}
